Now Available!

Native .Net
Components

TList WinForms
for
.Net Framework

&

MetaDraw WinForms
for
.Net Framework



Bennet-Tec
Components
Make you
look sharp!



Home

Company

Products

Order Forms

How To

Downloads

Updates

Support

Registration

Dependencies

Links

Compatibility

Site Map


MetaDraw


How to Create and Present Diagrams in your application

with support for VB, VB.NET, C#, C++, Access, FoxPro, etc

The MetaDraw diagramming control makes it easy to create and display diagrams in your applications.

Using MetaDraw you can create diagrams by code, or by allowing end-users to draw out their diagrams with their mouse.

Moreover once created your application code can recognize when the user is acting on a diagram node or link, and can also follow a diagram from node to node along the links.

Diagrams may consist of basic shapes, text, merged images, freehand drawing, and diagram lines. ( you can even use Animated GIFs as diagram nodes

ADDING DIAGRAM NODES

To add nodes by code just use the AddObject method.

The syntax is simple, just specifying the shape and bounding coordiantes

    MetaDraw.AddObject shape, X1, Y1, X2, Y2
    MetaDraw.LineWidth = 1
    MetaDraw.LineStyle = PS_DOT
    MetaDraw.FillStyle = FS_SOLID
    MetaDraw.FillColor = vbBlue

Shapes can be Ellipses, Rectangles, Round Rectangles, Triangles, Stars, other Polygons, Polylines, etc

For each shape you can also specify line style, line thickness, line color, fill colors, fill patterns, transparency, and associated hidden tags ( useful when user clicks on some node and you want to take appropriate action)

Similarly you can add Text, or merged in images.

To add Text, the first parameter should be OT_TEXT and then the next line of code you would specify the text string

    MetaDraw.AddObject shape, X1, Y1, X2, Y2
    MetaDraw.Text = "some string"
    MetaDraw.FontName = "Arial"
    MetaDraw.TextColor = RGB( 200, 100, 100 )

Note that you can specify fonts, fontsizes, bold, underline, italic, colors, etc Text may also be added at any angle, and may be single or wordwrapped.

To merge in an image, just call the LoadPicture method with the image file name as the first parameter, and Pic_PictureImage as the second parameter. This loads the image into an internal buffer. You can then add the image where desired with the AddObject method and 2nd parameter OT_Image

    MetaDraw.LoadPicture "c:\temp\SomeFileName", PIC_PICTUREIMAGE
    MetaDraw.AddObject shape, X1, Y1, X2, Y2

To allow users to draw out diagrams is equally easy

By setting the EditMode property MetaDraw will draw, select, move, or resize shapes in response to the user's mouse movement.

Just add a few buttons or menu items on your form / dialog and set the EditMode to the desired shape or action.
Here's a few lines of sample code:

    Sub mnuELLIPSE_Click( )
        MetaDraw.EditMode = ED_ELLIPSE
    End Sub

    Sub mnuRECTANGLE_Click( )
       MetaDraw.EditMode = ED_RECT
    End Sub

    Sub mnuSELECT_Click( )
       ' In this editmode, subject to the EditFlags property setting
       ' the user may select, mode, or resize nodes
       MetaDraw.EditMode = ED_SELECT
    End Sub

CONNECTING NODES WITH LINKS

MetaDraw supports a special object type called a Link. Links are displayed as straight lines or segmented lines with optional arrow heads of various styles connect any two nodes .

Links are very powerful - When a linked node is moved, MetaDraw will automatically update the links to maintain the connection.

To add a Link by code - just call the CreateLink method supplying the link type ( straight or segmented ) and references to the desired links.

To allow the user to create links with his mouse, just set the EditMode property to ED_LINKLINE

Text objects may also be associated with links as Link Labels. Such text objects are automatically moved with the link. They may also be aligned to (angled with) the link depending on the OS_LabelAngle flag in the ObjStatus property.

FOLLOWING THE LINKS

Using the properties ObjLinks, ObjLinkCount and LinkObject it is possible to programmatically follow the flow from one linked object to another. Additional detail for each node or link as stored in Object Tags can then be used to provide full information about some process flow.

RECOGNIZING USER ACTIONS

As already noted above many user actions are automatically handled.
With the EditMode property set the user can directly draw, move or resize nodes, or even add links.
Sometimes it is also desirable to recognize when the user clicks on, or moves over some a node .
In MetaDraw you can add multiple pieces of hidden named data to each node ( or link ) in the diagram. This is done using the ObjTags property. It is also possible to set up a node ( or link ) as a "hotspot" such that in EditMode VIEW, the cursor will automatically change over the hotspot and you can trap events when the user moves over the node or link, or clicks on the node or link.

SAVING THE RESULT

Of course the diagram may be saved at any point,
and reloaded for further manipulation.
To save just call the SavePicture method.
To Reload just call the LoadPicture method.

MUCH MUCH MORE

Follow the link to see a full set of MetaDraw features : Zooming, Scrolling, Printing, Drawing, Image Annotation, Diagramming, and more. .

SUPPORTED ENVIRONMENTS

MetaDraw is available in two editions - as either an ActiveX ( OCX ) or .NET Winforms component. MetaDraw may be used in any application supporting ActiveX or .NET Winforms components - for example Visual Basic ( either classic VB 6 or VB .NET ), C++, C#, Access, Delphi, FoxPro, or even within a web page using JavaScript, VBScript, HTML for viewing with Internet Explorer.


`


Copyright © Bennet-Tec Information Systems, Inc. All rights reserved.